<%--
  Created by IntelliJ IDEA.
  User: Mrzhangxi
  Date: 2021/2/19
  Time: 20:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<table width="500px" align="center" border="1px" cellspacing="0">
    <tr>
        <th>id</th>
        <th>username</th>
        <th>password</th>
        <th>gender</th>
        <th>registTime</th>
    </tr>
    <c:forEach items="${requestScope.pageData.list}" var="user">
        <tr>
            <td>${user.id}</td>
            <td>${user.username}</td>
            <td>${user.password}</td>
            <td>${user.gender}</td>
            <td>${user.registTime}</td>
        </tr>
    </c:forEach>
</table>
<div style="text-align: center">
    <a href="${pageContext.request.contextPath}/user?pageNum=1&pageSize=5">首页</a>
    <c:if test="${requestScope.pageData.hasPreviousPage}">
        <a href="${pageContext.request.contextPath}/user?pageNum=${requestScope.pageData.prePage}&pageSize=5">上一页</a>
    </c:if>

    <c:forEach begin="1" end="${requestScope.pageData.pages}" var="i">
        <c:if test="${requestScope.pageData.pageNum == i}">
            <span style="color: red;"> <a href="${pageContext.request.contextPath}/user?pageNum=${i}&pageSize=5"> ${i}</a></span>
        </c:if>
        <c:if test="${requestScope.pageData.pageNum != i}">
            <a href="${pageContext.request.contextPath}/user?pageNum=${i}&pageSize=5"> ${i}</a>
        </c:if>
    </c:forEach>

    <c:if test="${requestScope.pageData.hasNextPage}">
        <a href="${pageContext.request.contextPath}/user?pageNum=${requestScope.pageData.nextPage}&pageSize=5">下一页</a>
    </c:if>

    <a href="${pageContext.request.contextPath}/user?pageNum=${requestScope.pageData.pages}&pageSize=5">未页</a>

</div>
</body>
</html>
